//package com.sztz.handle;
//
//import cn.hutool.json.JSONUtil;
//import com.sztz.result.BaseResult;
//import com.sztz.result.ResultEnum;
//import com.sztz.utils.CommUtils;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.security.access.AccessDeniedException;
//import org.springframework.security.web.access.AccessDeniedHandler;
//import org.springframework.stereotype.Component;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//
///**
// * 用户已通过认证授权时访问无权限资源的处理
// * @author yzy
// * @date 2023/3/22 16:48
// */
//@Component
//@Slf4j
//public class MyAccessDeniedHandler implements AccessDeniedHandler {
//    @Override
//    public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException accessDeniedException){
//        log.info("用户没有权限访问 MyAccessDeniedHandler: {}",accessDeniedException.getMessage());
//        CommUtils.responseJsonMessage(response, JSONUtil.toJsonStr(BaseResult.fail(ResultEnum.USER_ACCESS_DENIED)));
//    }
//}
